package com.ahwei.es.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * <p>
 * 员工实体！
 * </p>
 *
 * @author ahWei
 * @email：ahwei163@qq.com
 * @since 2022-06-14 17:08:31
 */
@Data
@AllArgsConstructor
// 声明为ES文档，则放于索引库megacorp中
@Document(indexName = "megacorp")
public class Employee {

    /**
     * 文档的唯一标识
     */
    @Id
    private Long id;

    // Keyword表示内容不可分隔
    @Field(type = FieldType.Keyword)
    private String first_name;

    @Field(type = FieldType.Keyword)
    private String last_name;

    // Integer表示内容为整数
    @Field(type = FieldType.Integer)
    private Integer age;

    // 文本类型，支持分词
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String about;

    @Field(type = FieldType.Keyword)
    private String[] interests;
}
